@charset "UTF-8";
@import "common/var";
@import "mixins/mixins";
@include b(switch){
  display: inline-flex;
  align-items: center;
  position: relative;
  font-size: $--switch-font-size;
  line-height: $--switch-height;
  height: $--switch-height;
  vertical-align: middle;
  @include when(disabled) {
    & .zl-switch__core{
      cursor: not-allowed;
    }
  }
  @include e(core) {
    margin: 0;
    display: inline-block;
    position: relative;
    width: $--switch-width;
    height: $--switch-height;
    border: 1px solid $--switch-off-color;
    outline: none;
    border-radius: $--switch-core-border-radius;
    box-sizing: border-box;
    background: $--switch-off-color;
    cursor: pointer;
    transition: border-color .3s, background-color .3s;
    vertical-align: middle;

    &:after {
      content: "";
      position: absolute;
      top: 1px;
      left: 1px;
      border-radius: 100%;
      transition: all .3s;
      width: $--switch-button-size;
      height: $--switch-button-size;
      background-color: $--color-white;
    }
    @include m(small) {
      width: 28px;
      height: 16px;
      &:after {
        width: 12px;
        height: 12px;
      }
    }
  }

  @include e(input) {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    margin: 0;
  }
  @include e(text) {
    padding: 0 5px;
  }
  
  @include when(checked) {
    .zl-switch__core {
      border-color: $--switch-on-color;
      background-color: $--switch-on-color;
      &::after {
        left: 100%;
        margin-left: -$--switch-button-size - 1px;
      }
    }
    .zl-switch__core--small {
      border-color: $--switch-on-color;
      background-color: $--switch-on-color;
      &::after {
        left: 100%;
        margin-left: -12px;
      }
    }
  }
  @include when(disabled) {
    opacity: 0.6;
    cursor: not-allowed;
  }
}